import { IFeidaoAiBrowserComponent } from '@dfeidao/atom-web/interfaces';
import get from '@dfeidao/atom-web/local/get';
import fire from '@dfeidao/atom-web/msg/fire';
import nodejs from '@dfeidao/atom-web/msg/nodejs';
import error from '@dfeidao/atom-web/msgbox/error';
import success from '@dfeidao/atom-web/msgbox/success';
import set_node_cls from '@dfeidao/atom-web/ui/set-node-cls';
export default async function a003(fd: IFeidaoAiBrowserComponent) {
	// 调用数据
	const project_asset_no = get(fd, 'project_asset_no');
	// 调用方法-根据项目资产编号删除数据
	const res = await nodejs<{
		code: 0 | 1;
		result: string;
	}>('project-assets/zj-000006/s001', {
		project_asset_no
	});
	// 判定是否删除成功
	if (res.code === 1) {
		success("删除成功");
		// 修改提示框的样式
		const del = fd.data.node.querySelector<HTMLElement>('[data-id="del"]');
		set_node_cls(del, 'display-n', true);// 成功后刷新列表
		fire('zj-000002','a009');
	} else {
		error("删除失败");
	}
}
